package com.adingxiong.quickstart.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName CorsMappingConfig
 * @Description 全局解决跨域问题
 * @Author xiongchao
 * @Date 2020/5/29 9:37
 **/
@Configuration
public class CorsMappingConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/dev/**")
                .allowCredentials(true)
                .allowedMethods("GET","PUT","DELETE","POST","OPTIONS")
                .maxAge(3600);
    }
}
